#include<iostream>
#include<thread>
#include<unistd.h>

using namespace std;

void func(char* mybuf)
{
    cout<<" mybuf = "<<mybuf<<endl;
    cout<<"&mybuf = "<<static_cast<void*>(mybuf)<<endl;

    return;
}

int main()
{
    char buf[] = "Hello World";
    cout<<" buf   = "<<buf<<endl;
    cout<<"&buf   = "<<static_cast<void*>(buf)<<endl;
    thread myobj(func, buf);
    myobj.detach();
    sleep(1); // 主线程等待1s来让子线程的打印输出
    cout<<"-----main---thread-----"<<endl;

    return 0;
}